export default defineNuxtRouteMiddleware((to, from) => {
   if(process.client) {
       // 1: 获取到是否登录
       const isLogin = useIsLogin()
       // 2: 如果登录那么直接跳转到首页
       if (!isLogin) {
          window.location.href = "/login?from=" + to.fullPath
       }

       const userStore = useStore.userState()
       if(userStore.role != 'admin'){
           showError({statusMessage:"您没有权限",statusCode:404})
       }
   }
});
